home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 263_01 / c_wndw.h < prev    next >
Text File  |  1990-02-13  |  12KB  |  327 lines

  1. /* header file for windowing system
  2. *
  3. *    Copr. (c) Marietta Systems, Inc.  1987,1988,1989
  4. *    All rights reserved
  5. *    Version 1.2x
  6. *
  7. *    This header file declares the functions for the windowing system
  8. *   Globals for the windowing system.
  9. *
  10. */
  11.  
  12. /*
  13. * * * * * * * * *
  14. *     Figure out which compiler is being used
  15. *
  16. */
  17. #ifdef _CDECL
  18. #define QUICKC
  19. #endif
  20. #ifdef _Cdecl
  21. #define TURBOC
  22. #endif
  23. #ifndef LATTICE
  24. typedef unsigned char byte;
  25. #define _STACK _stklen
  26. #endif
  27.  
  28. /*
  29. */
  30. enum fld_type {alphanum, graphic, flag, boolean, calendar, numeric, value,
  31.     real, chrono};
  32. enum COLOR_OF {Mblack,Mblue,Mgreen,Mcyan,Mred,Mmagenta,Myellow,Mwhite};
  33. enum _JUST {left, right, as_typed, center, code, decimal, db_number,
  34.      c_number, date, _time};
  35. enum ATTRIB {low,high,reverse,blink,blank,alt_low,alt_high,alt_reverse}
  36.     OLD_BRIG = low;
  37. enum F_READ {firstrec, previous, nextrec, lastrec, random, relative};
  38. enum F_MODE {append, readonly, recreate, update};
  39. enum F_TYPE {ascii, binary, dbase3, hashed, marietta};
  40. struct CURSR {int X,Y;} _CURSOR; /* Current cursor position in window */
  41.  
  42. struct WINDW {  /* window tracking struct */
  43.     void *sobj;  /* pointer to list of screen objects */
  44.     byte *SCREEN, *FUNCTION;
  45.     struct CURSR LOCN;
  46.     int X, Y;   /* location of top left corner of window */
  47.     int H, W;   /* height and width of window, including borders */
  48.     int P;
  49.     int CODE, K, Z, sequ, tx, ty;
  50.     } *WINDOW;
  51.  
  52. struct CLR_TYPE {
  53.     enum COLOR_OF FORE, BACK;
  54.     int ALT_CLR;
  55.     };
  56.  
  57. struct F_DEF { /* file definition control struct */
  58.     long prime;        /* size of file in records */
  59.     long location;
  60.     long r_count;      /* active (IN_USE) record count (set by program) */
  61.     byte *record;      /* pointer to start of record */
  62.     void *fnext;       /* pointer to data dictionary */
  63.     void *fptr[5];
  64.     enum F_TYPE ftype; /* type of file */
  65.     int key_len, offset; /* key info for hashed files */
  66.     int start;         /* size of header area at start of file */
  67.     unsigned rec_len;  /* record length */
  68.     unsigned fbloc;
  69.     int keycode;
  70.     int ismemo;        /* set 1 if .DBF file with associated memo file */
  71.     int write;
  72.     int ndx;
  73.     int realfile;      /* contains the real file handle of the file */
  74.     unsigned bufsize;
  75.     char fvol;         /* disk/volume code */
  76.     char fpath[61];    /* directory path */
  77.     char fname[13];    /* file name with extension */
  78.     } *FN;
  79.  
  80. struct DBF_DEF { /* dBase III Plus data dictionary struct */
  81.     void *dnext;
  82.     enum _JUST just;   /* justification code of field (modifyable) */
  83.     int dbf_len;       /* dBASE field length */
  84.     int dbf_dec;       /* decimals for an N type field */
  85.     int dbf_set;       /* Active field (set by program) */
  86.     int dbf_dig;       /* justify() and accept() 'len' parameter */
  87.     unsigned posn;     /* position of start of field in record */
  88.     unsigned ndxfield;
  89.     byte dbf_name[11]; /* field name in ASCIIZ format */
  90.     byte dbf_type;     /* Type (C, D, L, M, N) */
  91.     };
  92.  
  93. /*
  94. * * * * * * * * * * * *
  95. *   Initiation of globals for the windowing system.
  96. *
  97. */
  98. long _SIZMEM;
  99. unsigned SCRN_PTR, CLR_PTR = 0X0000, _DSEG, _DOFF, CLR_SEG = 0XB800,
  100.     MONO_SEG = 0XB000;
  101. unsigned short SCR_SIZE, OLD_CODE, _brkflag;
  102. unsigned INCHAR, INCHAR_F;
  103. int INS_FLAG = 1, W_NUM = 0, CLR_INIT = 0;
  104. int COLOR_SC, EGA_SCRN, CLR_CODE;
  105. byte *MEM_LINE;
  106. char *xgoodbye;
  107.  
  108. struct CLR_TYPE COLOR [7] = {    /* number of elements must match
  109.                                  * "_COLORS" configuration constant */
  110.         {Mgreen, Mblack, 6},    /* base window color, #0 */
  111.         {Mwhite, Mblue, 3},        /* color #1 */
  112.         {Mcyan, Mblack, 4},        /* color #2 */
  113.         {Mcyan, Mred, 5},        /* color #3 */
  114.         {Mwhite, Mmagenta, 2},  /* color #4 */
  115.         {Myellow, Mblack, 1},   /* color #5 */
  116.         {Mwhite, Mred, 0},        /* color #6 */
  117.                 };
  118. struct CLR_TYPE    TOP_CLR = {Myellow,Mblue,6}; /* top line color */
  119. struct CLR_TYPE    ER_COLOR = {Mgreen,Mred,6};  /* bottom line color */
  120.  
  121. unsigned KEYMATCH[8] /* the key match array which determines which
  122.                       * function keys are treated as 'end-of-field'
  123.                       * keys by the 'isendch' function */
  124.     = {0X0, 0X0, 0X0, 0X0, 0X0, 0X0, 0X0, 0X0};
  125.  
  126. byte *KEY_DISPLAY[7] = {"Srch", "Move", "Ins", "Del", "Zoom","Amnd", "AKey"};
  127.     /* meanings for function keys F3 through F9 displayed on bottom line */
  128.  
  129. byte *BANNER_MSG = /* Modifyable initial window display on software loading */
  130. " The \"c_wndw\" (tm) and \"c_ndx\" (tm) toolkits \n\
  131.  are the copyright of Marietta Systems, Inc. \n\
  132.  1987, 1988, 1989.  All rights reserved. \n\
  133.   Release Version 2.01 - 8/30/89 ";
  134.  
  135. /*
  136. * * * * * * * * * * * * *
  137. *    Configuration constants
  138. *
  139. *    Change their initial value to suit your set-up
  140. *        - but be careful!!
  141. *
  142. */
  143. int CLR_TONE = 25;   /* controls display of copywrite box by 'clr_scrn()' */
  144. int A_TRACK = -1;    /* used by 'accept()' function */
  145. int SAVEWAIT = 900; /* clock ticks before 'scrnsave(0)' flushes file buffers */
  146. enum ATTRIB ACC_DISP = reverse; /* Attribute of accept() fields after entry */
  147. int ERR_BEEP = 2;    /* For beep length with 'shortbeep()', 0 = tiny beep */
  148. int UP_NAME = 0;    /* 1 if names are to be in uppercase only */
  149. int FLD_FULL = 1;   /* 1 for auto ENTER on full field; 0 = ENTER required */
  150. int TAB_SET = 4;    /* size of tab increments on screen for '\t' code */
  151. int _WINDW = 10;    /* maximum number of windows */
  152. int _COLORS = 7;    /* maximum number of different color selections */
  153. int SCRN_LEN = 25;  /* screen length in lines */
  154. int SCRN_WID = 80;  /* screen width in columns */
  155. int TOP_LINE = 1;   /* lines dedicated to the "top-frame" at top of screen */
  156. int BOT_LINE = 1;   /* True if active keys to be displayed on bottom line */
  157. int MENULINE = 1;    /* True to display assist line for menus */
  158. int ERRORMSG = 1;   /* True to display non-critical errors with sys_wndw() */
  159. int GOODBYEMSG = 1; /* True to display end of program message */
  160. int MAXFILES = 9;   /* maximum number of files to create file buffers */
  161. int D_FORMAT = 'U'; /* U for USA format, E for european, I for intl */
  162. int D_PUNCT = '/';    /* punctuation character for date formats */
  163. int D_20XX = 10;    /* split between 20xx and 19xx in years */
  164. int PERIOD = '.';    /* decimal point character */
  165. int COMMA = ',';    /* thousands seperator */
  166. int BOOL_YES = 'Y'; /* The TRUE or YES boolean entry code */
  167. int BOOL_NO = 'N';  /* The FALSE or NO boolean entry code */
  168. int CLOCK24 = 0;    /* 0 for am/pm, or 1 for 24 hour european/military time */
  169. int QTRHOUR = 0;    /*  */
  170. int T_PUNCT = ':';  /* time punctuation character, default colon */
  171. unsigned DISCBLCK = 4100; /* maximum record size of any file to be opened,
  172.            * Minimum size is 512, but recommended minimum is 2060.
  173.            * if actual record size is less than one third of this size,
  174.            * the file access software will perform disk caching
  175.            * Maximum size is 65000 */
  176. short MEM_WARN = 1024; /* Warning will be issued when unused heap memory is
  177.                         * under this.  Maximum is 9999, minimum is 0 */
  178. long MAX_WIND = 15000L; /* maximum amount of heap space for windowing
  179.           * functions. The maximum size is 65000, and the minimum size
  180.           * of MAX_WIND should be 8500. To calculate, use the formula:-
  181.           * ((number of windows * average size * 2) + 2500)
  182.           * where 'average size' is (height * width)   */
  183. long _MNEED = 20000L; /* minimum heap space needed, which must be
  184.           * at least MAX_WIND + 5000. */
  185. unsigned _STACK = 10000; /* size of stack, (at least 7000) */
  186.  
  187. /*
  188. * * * * * * * * * * *
  189. *     This section contains the #define codes
  190. *
  191. */
  192. #define CTL_A     1 /* all the other CTL combinations can be defined here */
  193. #define PGDN      3
  194. #define CRS_RT    4 /* Right cursor */
  195. #define CRS_UP    5 /* Up cursor */
  196. #define DEL       7
  197. #define B_SPACE   8
  198. #define TAB       9
  199. #define CTL_ENT  10
  200. #define SFT_TAB  11
  201. #define ENTER    13
  202. #define PGUP     18
  203. #define CRS_LT   19 /* Left cursor */
  204. #define CTL_BSPC 20 /* Ctrl + backspace */
  205. #define INS      22
  206. #define HOME     23
  207. #define CRS_DN   24 /* Down cursor */
  208. #define END      26
  209. #define CTL_Z    26 /* 0X1A */
  210. #define ESC      27
  211. #define ALT_Q   129 /* The other ALT alpha keys can be defined here */
  212. #define ALT_P   138 /* Print translated screen */
  213. #define